from django.db import models
from users.models import User
from goods.models import Good

# Create your models here.
# 收藏表
# user_id   good_id
#    2          3


class Collect(models.Model):
    user = models.ForeignKey(User, on_delete=models.CASCADE, verbose_name='用户')
    good = models.ForeignKey(Good, on_delete=models.CASCADE, verbose_name='商品')

    class Meta:
        db_table = 'collect_tb'
        verbose_name_plural = "收藏表"

    def __str__(self):
        return "用户%s 收藏了商品 %s"%(self.user.username, self.good.sku_name)









